/* eslint-disable no-unused-vars */
import namespace from "../../namespace";

class DefaultKeyboardPolicy extends namespace.policy.canvas.KeyboardPolicy {
  constructor() {
    super();
  }

  onKeyDown(canvas, keyCode) { }

  onKeyUp(canvas, keyCode) {
    switch (keyCode) {
      case 27:
        this.onPressEscKeyboard();
        break;
      case 8:
        this.removeFigures(canvas);
        break;
    }
  }

  removeFigures(canvas) {
    let all = canvas.getSelection().all.data.concat([]);
    all.forEach(f => canvas.removeFigure(f));
  }

  onPressEscKeyboard() { }
}
namespace.policy.canvas.DefaultKeyboardPolicy = DefaultKeyboardPolicy;
